package com.leung.listener;


import com.leung.constant.MessageType;
import com.leung.domain.entity.DeviceConfig;
import com.leung.domain.messageEntity.MqMessage;
import com.leung.service.IDeviceConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
/**
 * @author 丨一
 * @version 1.0
 * @title WebMessageListener
 * @description:
 * @date 2025/3/6 下午2:27
 */

@Slf4j
@Component
public class WebMessageListener {

    @Resource
    private IDeviceConfigService deviceConfigService;

    @RabbitListener(bindings = @QueueBinding(value = @Queue(name = "tcpweb.direct.queue"),exchange = @Exchange(name = "tcpweb.direct",type = ExchangeTypes.DIRECT),key = {"tcpWeb"}))
    public void listenDirectQueue(MqMessage<DeviceConfig> mqMessage) {
        if (mqMessage.getMessageType().equals(MessageType.DEBUG)) {
            log.info("{}", mqMessage);
        }
    }
    
    
    
}
